package com.top.application.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.netflix.eureka.server.event.EurekaInstanceCanceledEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;

/**
 * 
 * @ClassName: InstanceCannelListener 
 * @Description: TODO(建通服务关闭信息，并对此信息做提醒记录，不做后续操作) 
 * @author zhaiey
 * @date 2018年3月29日 下午4:21:11 
 *
 */
@Configuration
public class InstanceCannelListener implements ApplicationListener<EurekaInstanceCanceledEvent>{
	 private static final Logger log = LoggerFactory.getLogger(InstanceCannelListener.class);
	/**
	 * 实现注册取消接口onApplicationEvent方法
	 */
	@Override
	public void onApplicationEvent(EurekaInstanceCanceledEvent event) {
		String appname = event.getAppName();
		String serverId = event.getServerId();
		String source = event.getSource().toString();
		log.info("appname:"+appname+",serverId:"+serverId+",source:"+source+"服务已停止");
	}
	
}
